package com.example.demo;

import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component
public class ServiceTestImpl implements ServiceTest {
	@Autowired
	@Qualifier("sessionFactory1")
	private SessionFactory sessionFactory1;

	@Autowired
	@Qualifier("sessionFactory2")
	private SessionFactory sessionFactory2;

	@Override
	public String m1() {
		Transaction a;
		a = sessionFactory1.getCurrentSession().getTransaction();
		return "m1";
	}

	@Override
	public String m2() {
		Transaction a;
		a = sessionFactory2.getCurrentSession().getTransaction();
		return "m2";
	}

}
